package com.service.impl;

import com.bean.Commodity;
import com.dao.CommodityMapper;
import com.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 商品业务逻辑实现
 */
@Service
public class CommodityServiceImpl implements CommodityService {

    @Autowired
    private CommodityMapper commodityMapper;


    @Override
    public int save(Commodity commodity) {
        return commodityMapper.insert(commodity);
    }

    @Override
    public int remove(Commodity commodity) {
        return commodityMapper.delete(commodity);
    }

    @Override
    public int modify(Commodity commodity) {
        return commodityMapper.update(commodity);
    }

    @Override
    public List<Commodity> find(Commodity commodity) {
        return commodityMapper.select(commodity);
    }

    @Override
    public int count(Map<String, Object> map) {
        return commodityMapper.selectCount(map);
    }

    @Override
    public List<Commodity> query(Map<String, Object> map) {
        return commodityMapper.selectByPage(map);
    }
}
